-- @owner: cr13
-- @date: 2023-05-19
-- @testpoint: opengauss关键字also(非保留)，作为触发器名，合理报错

--step1:创建源表 expect:成功
drop table if exists t_keywords_also_0030;
create table t_keywords_also_0030(id1 int, id2 int, id3 int);

--step2:创建触发器函数 expect:成功
create or replace function tri_insert_func() returns trigger as  
           $$  
           declare
           begin 
               insert into test_trigger_des_tbl values(new.id1, new.id2, new.id3);
               return new;
           end
           $$ language plpgsql;
/

--step3:创建INSERT触发器不带引号 expect:创建成功
drop trigger if exists also on t_keywords_also_0030;
create trigger also before insert on t_keywords_also_0030 for each row execute procedure tri_insert_func();
/

--step4:创建INSERT触发器带双引号 expect:创建成功
drop trigger if exists "also" on t_keywords_also_0030;
create trigger "also" before insert on t_keywords_also_0030 for each row execute procedure tri_insert_func();
/

--step5:创建INSERT触发器带单引号 expect:合理报错
drop trigger if exists 'also' on t_keywords_also_0030;
create trigger 'also' before insert on t_keywords_also_0030 for each row execute procedure tri_insert_func();
/

--step6:创建INSERT触发器带反单引号 expect:合理报错
drop trigger if exists `admin` on t_keywords_also_0030;
create trigger `admin` before insert on t_keywords_also_0030 for each row execute procedure tri_insert_func();
/

--step7:清理环境 expect:成功
drop trigger if exists also on t_keywords_also_0030;
drop function tri_insert_func;
drop table if exists t_keywords_also_0030;
